/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.entites;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.NamedStoredProcedureQueries;
import javax.persistence.NamedStoredProcedureQuery;
import javax.persistence.OneToMany;
import javax.persistence.ParameterMode;
import javax.persistence.StoredProcedureParameter;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Chung
 */
@Entity
@Table(name = "NotificationType")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NotificationType.findAll", query = "SELECT n FROM NotificationType n"),
    @NamedQuery(name = "NotificationType.findById", query = "SELECT n FROM NotificationType n WHERE n.id = :id"),
    @NamedQuery(name = "NotificationType.findByDestype", query = "SELECT n FROM NotificationType n WHERE n.destype = :destype")})
@NamedStoredProcedureQueries({
    
   @NamedStoredProcedureQuery(name = "NotificationType.getNotification", procedureName = "sp_getNotification",parameters = {
        @StoredProcedureParameter(name="NotificationTypeID",mode=ParameterMode.IN,type = Integer.class),
        @StoredProcedureParameter(name="Username",mode=ParameterMode.IN,type = String.class)
   }),
    
   @NamedStoredProcedureQuery(name = "NotificationType.checkNotification", procedureName = "sp_checkNotification",parameters = {
   }),
   
   @NamedStoredProcedureQuery(name = "NotificationType.checkNotification1", procedureName = "sp_checkNotification1",parameters = {
   }),
   @NamedStoredProcedureQuery(name = "NotificationType.Birthdaywishes", procedureName = "sp_Birthdaywishes",parameters = {
        @StoredProcedureParameter(name="UsernameFE",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="AvatarImg",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="Fullname",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="Message",mode=ParameterMode.IN,type = String.class)
   }),
   @NamedStoredProcedureQuery(name = "NotificationType.Eventinvitations", procedureName = "sp_Eventinvitations",parameters = {
        @StoredProcedureParameter(name="UsernameME",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="UsernameFE",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="AvatarImg",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="Fullname",mode=ParameterMode.IN,type = String.class),
        @StoredProcedureParameter(name="EventId",mode=ParameterMode.IN,type = Integer.class)
   }),
   @NamedStoredProcedureQuery(name = "NotificationType.ChangeStatus", procedureName = "sp_ChangeStatus",parameters = {
        @StoredProcedureParameter(name="Id",mode=ParameterMode.IN,type = Integer.class)
       
   })
   
        
 })



public class NotificationType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "Id")
    private Integer id;
    @Size(max = 100)
    @Column(name = "Destype")
    private String destype;
    @OneToMany(mappedBy = "notificationTypeID")
    private List<Notifications> notificationsList;

    public NotificationType() {
    }

    public NotificationType(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDestype() {
        return destype;
    }

    public void setDestype(String destype) {
        this.destype = destype;
    }

    @XmlTransient
    public List<Notifications> getNotificationsList() {
        return notificationsList;
    }

    public void setNotificationsList(List<Notifications> notificationsList) {
        this.notificationsList = notificationsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NotificationType)) {
            return false;
        }
        NotificationType other = (NotificationType) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entites.NotificationType[ id=" + id + " ]";
    }
    
}
